package com.zlf.sb.demo.design.factory;

import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public abstract class AbstractSceneHandleBase<A, T, G> implements SceneHandleBase<A, T, G> {

    /**
     * 场景实现类的执行方法
     *
     * @param params
     * @return
     * @throws Exception
     */
    public abstract G execute(T params);


    /**
     * 打印执行异常日志,并监控异常
     */
    @Override
    public G doCallback(T params) {
        try {
            return execute(params);
        } catch (Exception e) {
            //log.error("{}, |StatusHandleBase_doCallback|error|,className:{}, doCallback, params:{}, msg:{}", EagleEye.getTraceId(), this.getClass().getSimpleName(), JSON.toJSONString(params), e.getMessage(), e);
            throw e;
        }
    }

}